home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tk8.0 / win / tkWinInt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-15  |  5.5 KB  |  196 lines  |  [TEXT/CWIE]

  1. /*
  2.  * tkWinInt.h --
  3.  *
  4.  *    This file contains declarations that are shared among the
  5.  *    Windows-specific parts of Tk, but aren't used by the rest of
  6.  *    Tk.
  7.  *
  8.  * Copyright (c) 1995 Sun Microsystems, Inc.
  9.  *
  10.  * See the file "license.terms" for information on usage and redistribution
  11.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12.  *
  13.  * SCCS: @(#) tkWinInt.h 1.33 97/05/20 17:00:35
  14.  */
  15.  
  16. #ifndef _TKWININT
  17. #define _TKWININT
  18.  
  19. #ifndef _TKINT
  20. #include "tkInt.h"
  21. #endif
  22.  
  23. /*
  24.  * Include platform specific public interfaces.
  25.  */
  26.  
  27. #ifndef _TKWIN
  28. #include "tkWin.h"
  29. #endif
  30.  
  31. /*
  32.  * Define constants missing from older Win32 SDK header files.
  33.  */
  34.  
  35. #ifndef WS_EX_TOOLWINDOW
  36. #define WS_EX_TOOLWINDOW    0x00000080L 
  37. #endif
  38.  
  39. typedef struct TkFontAttributes TkFontAttributes;
  40.  
  41. /*
  42.  * The TkWinDCState is used to save the state of a device context
  43.  * so that it can be restored later.
  44.  */
  45.  
  46. typedef struct TkWinDCState {
  47.     HPALETTE palette;
  48. } TkWinDCState;
  49.  
  50. /*
  51.  * The TkWinDrawable is the internal implementation of an X Drawable (either
  52.  * a Window or a Pixmap).  The following constants define the valid Drawable
  53.  * types.
  54.  */
  55.  
  56. #define TWD_BITMAP    1
  57. #define TWD_WINDOW    2
  58. #define TWD_WINDC    3
  59.  
  60. typedef struct {
  61.     int type;
  62.     HWND handle;
  63.     TkWindow *winPtr;
  64. } TkWinWindow;
  65.  
  66. typedef struct {
  67.     int type;
  68.     HBITMAP handle;
  69.     Colormap colormap;
  70.     int depth;
  71. } TkWinBitmap;
  72.  
  73. typedef struct {
  74.     int type;
  75.     HDC hdc;
  76. }TkWinDC;
  77.  
  78. typedef union {
  79.     int type;
  80.     TkWinWindow window;
  81.     TkWinBitmap bitmap;
  82.     TkWinDC winDC;
  83. } TkWinDrawable;
  84.  
  85. /*
  86.  * The following macros are used to retrieve internal values from a Drawable.
  87.  */
  88.  
  89. #define TkWinGetHWND(w) (((TkWinDrawable *) w)->window.handle)
  90. #define TkWinGetWinPtr(w) (((TkWinDrawable*)w)->window.winPtr)
  91. #define TkWinGetHBITMAP(w) (((TkWinDrawable*)w)->bitmap.handle)
  92. #define TkWinGetColormap(w) (((TkWinDrawable*)w)->bitmap.colormap)
  93. #define TkWinGetHDC(w) (((TkWinDrawable *) w)->winDC.hdc)
  94.  
  95. /*
  96.  * The following structure is used to encapsulate palette information.
  97.  */
  98.  
  99. typedef struct {
  100.     HPALETTE palette;        /* Palette handle used when drawing. */
  101.     UINT size;            /* Number of entries in the palette. */
  102.     int stale;            /* 1 if palette needs to be realized,
  103.                  * otherwise 0.  If the palette is stale,
  104.                  * then an idle handler is scheduled to
  105.                  * realize the palette. */
  106.     Tcl_HashTable refCounts;    /* Hash table of palette entry reference counts
  107.                  * indexed by pixel value. */
  108. } TkWinColormap;
  109.  
  110. /*
  111.  * The following macro retrieves the Win32 palette from a colormap.
  112.  */
  113.  
  114. #define TkWinGetPalette(colormap) (((TkWinColormap *) colormap)->palette)
  115.  
  116. /*
  117.  * The following macros define the class names for Tk Window types.
  118.  */
  119.  
  120. #define TK_WIN_TOPLEVEL_CLASS_NAME "TkTopLevel"
  121. #define TK_WIN_CHILD_CLASS_NAME "TkChild"
  122.  
  123. /*
  124.  * The following variable indicates whether we are restricted to Win32s
  125.  * GDI calls.
  126.  */
  127.  
  128. extern int tkpIsWin32s;
  129.  
  130. /*
  131.  * The following variable is a translation table between X gc functions and
  132.  * Win32 raster op modes.
  133.  */
  134.  
  135. extern int tkpWinRopModes[];
  136.  
  137. /*
  138.  * The following defines are used with TkWinGetBorderPixels to get the
  139.  * extra 2 border colors from a Tk_3DBorder.
  140.  */
  141.  
  142. #define TK_3D_LIGHT2 TK_3D_DARK_GC+1
  143. #define TK_3D_DARK2 TK_3D_DARK_GC+2
  144.  
  145. /*
  146.  * Internal procedures used by more than one source file.
  147.  */
  148.  
  149. extern LRESULT CALLBACK    TkWinChildProc _ANSI_ARGS_((HWND hwnd, UINT message,
  150.                 WPARAM wParam, LPARAM lParam));
  151. extern void        TkWinClipboardRender _ANSI_ARGS_((TkDisplay *dispPtr,
  152.                 UINT format));
  153. extern LRESULT        TkWinEmbeddedEventProc _ANSI_ARGS_((HWND hwnd,
  154.                 UINT message, WPARAM wParam, LPARAM lParam));
  155. extern void        TkWinFillRect _ANSI_ARGS_((HDC dc, int x, int y,
  156.                 int width, int height, int pixel));
  157. extern COLORREF        TkWinGetBorderPixels _ANSI_ARGS_((Tk_Window tkwin,
  158.                 Tk_3DBorder border, int which));
  159. extern HDC        TkWinGetDrawableDC _ANSI_ARGS_((Display *display,
  160.                 Drawable d, TkWinDCState* state));
  161. extern int        TkWinGetModifierState _ANSI_ARGS_((void));
  162. extern HPALETTE        TkWinGetSystemPalette _ANSI_ARGS_((void));
  163. extern HMODULE        TkWinGetTkModule _ANSI_ARGS_((void));
  164. extern HWND        TkWinGetWrapperWindow _ANSI_ARGS_((Tk_Window tkwin));
  165. extern int        TkWinHandleMenuEvent _ANSI_ARGS_((HWND *phwnd,
  166.                 UINT *pMessage, WPARAM *pwParam, LPARAM *plParam,
  167.                 LRESULT *plResult));
  168. extern int        TkWinIndexOfColor _ANSI_ARGS_((XColor *colorPtr));
  169. extern void        TkWinPointerDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  170. extern void        TkWinPointerEvent _ANSI_ARGS_((HWND hwnd, int x,
  171.                 int y));
  172. extern void        TkWinPointerInit _ANSI_ARGS_((void));
  173. extern LRESULT         TkWinReflectMessage _ANSI_ARGS_((HWND hwnd,
  174.                 UINT message, WPARAM wParam, LPARAM lParam));
  175. extern void        TkWinReleaseDrawableDC _ANSI_ARGS_((Drawable d,
  176.                 HDC hdc, TkWinDCState* state));
  177. extern LRESULT        TkWinResendEvent _ANSI_ARGS_((WNDPROC wndproc,
  178.                 HWND hwnd, XEvent *eventPtr));
  179. extern HPALETTE        TkWinSelectPalette _ANSI_ARGS_((HDC dc,
  180.                 Colormap colormap));
  181. extern void        TkWinSetMenu _ANSI_ARGS_((Tk_Window tkwin,
  182.                 HMENU hMenu));
  183. extern void        TkWinSetWindowPos _ANSI_ARGS_((HWND hwnd,
  184.                 HWND siblingHwnd, int pos));
  185. extern void        TkWinUpdateCursor _ANSI_ARGS_((TkWindow *winPtr));
  186. extern void        TkWinWmCleanup _ANSI_ARGS_((HINSTANCE hInstance));
  187. extern HWND        TkWinWmFindEmbedAssociation _ANSI_ARGS_((
  188.                 TkWindow *winPtr));
  189. extern void        TkWinWmStoreEmbedAssociation _ANSI_ARGS_((
  190.                 TkWindow *winPtr, HWND hwnd));
  191. extern void        TkWinXCleanup _ANSI_ARGS_((HINSTANCE hInstance));
  192. extern void         TkWinXInit _ANSI_ARGS_((HINSTANCE hInstance));
  193.  
  194. #endif /* _TKWININT */
  195.  
  196.